home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Compilers / digital marsC compier / dm / include / win32 / Dbt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-08  |  10.4 KB  |  357 lines

  1. /*****************************************************************************
  2.  *
  3.  *  Copyright (c) 1993-1996 Microsoft Corporation
  4.  *
  5.  *  Title:      DBT.H - Equates for WM_DEVICECHANGE and BroadcastSystemMessage
  6.  *
  7.  *  Version:    4.00
  8.  *
  9.  *  Date:       24-May-1993
  10.  *
  11.  *  Author:     rjc
  12.  *
  13.  *----------------------------------------------------------------------------
  14.  *
  15.  *  Change log:
  16.  *
  17.  *     DATE     REV                 DESCRIPTION
  18.  *  ----------- --- ----------------------------------------------------------
  19.  *
  20.  *****************************************************************************/
  21.  
  22. #ifndef _DBT_H
  23. #define    _DBT_H
  24.  
  25. /*
  26.  * BroadcastSpecialMessage constants.
  27.  */
  28. #define WM_DEVICECHANGE        0x0219
  29.  
  30. /* XLATOFF */
  31. #ifdef    IS_32
  32. #define    DBTFAR
  33. #else
  34. #define    DBTFAR    far
  35. #endif
  36. /* XLATON */
  37.  
  38. /*
  39.  * Broadcast message and receipient flags.
  40.  *
  41.  * Note that there is a third "flag". If the wParam has:
  42.  *
  43.  * bit 15 on:    lparam is a pointer and bit 14 is meaningfull.
  44.  * bit 15 off:    lparam is just a UNLONG data type.
  45.  *
  46.  * bit 14 on:    lparam is a pointer to an ASCIIZ string.
  47.  * bit 14 off:    lparam is a pointer to a binary struture starting with
  48.  *        a dword describing the length of the structure.
  49.  */
  50. #define BSF_QUERY        0x00000001
  51. #define BSF_IGNORECURRENTTASK    0x00000002    /* Meaningless for VxDs */
  52. #define BSF_FLUSHDISK        0x00000004    /* Shouldn't be used by VxDs */
  53. #define BSF_NOHANG              0x00000008
  54. #define BSF_POSTMESSAGE        0x00000010
  55. #define BSF_FORCEIFHUNG         0x00000020
  56. #define BSF_NOTIMEOUTIFNOTHUNG  0x00000040
  57. #define    BSF_MSGSRV32ISOK    0x80000000    /* Called synchronously from PM API */
  58. #define    BSF_MSGSRV32ISOK_BIT    31        /* Called synchronously from PM API */
  59.  
  60. #define BSM_ALLCOMPONENTS    0x00000000
  61. #define BSM_VXDS                0x00000001
  62. #define BSM_NETDRIVER           0x00000002
  63. #define BSM_INSTALLABLEDRIVERS  0x00000004
  64. #define BSM_APPLICATIONS        0x00000008
  65.  
  66. /*
  67.  * Message = WM_DEVICECHANGE
  68.  * wParam  = DBT_APPYBEGIN
  69.  * lParam  = (not used)
  70.  *
  71.  *    'Appy-time is now available.  This message is itself sent
  72.  *    at 'Appy-time.
  73.  *
  74.  * Message = WM_DEVICECHANGE
  75.  * wParam  = DBT_APPYEND
  76.  * lParam  = (not used)
  77.  *
  78.  *    'Appy-time is no longer available.  This message is *NOT* sent
  79.  *    at 'Appy-time.  (It cannot be, because 'Appy-time is gone.)
  80.  *
  81.  * NOTE!  It is possible for DBT_APPYBEGIN and DBT_APPYEND to be sent
  82.  * multiple times during a single Windows session.  Each appearance of
  83.  * 'Appy-time is bracketed by these two messages, but 'Appy-time may
  84.  * momentarily become unavailable during otherwise normal Windows
  85.  * processing.  The current status of 'Appy-time availability can always
  86.  * be obtained from a call to _SHELL_QueryAppyTimeAvailable.
  87.  */
  88. #define DBT_APPYBEGIN            0x0000
  89. #define DBT_APPYEND            0x0001
  90.  
  91. /*
  92.  * Message = WM_DEVICECHANGE
  93.  * wParam  = DBT_DEVNODES_CHANGED
  94.  * lParam  = 0
  95.  *
  96.  *    send when configmg finished a process tree batch. Some devnodes
  97.  *    may have been added or removed. This is used by ring3 people which
  98.  *    need to be refreshed whenever any devnode changed occur (like
  99.  *    device manager). People specific to certain devices should use
  100.  *    DBT_DEVICE* instead.
  101.  */
  102.  
  103. #define DBT_DEVNODES_CHANGED            0x0007
  104.  
  105. /*
  106.  * Message = WM_DEVICECHANGE
  107.  * wParam  = DBT_QUERYCHANGECONFIG
  108.  * lParam  = 0
  109.  *
  110.  *      sent to ask if a config change is allowed
  111.  */
  112.  
  113. #define DBT_QUERYCHANGECONFIG           0x0017
  114.  
  115. /*
  116.  * Message = WM_DEVICECHANGE
  117.  * wParam  = DBT_CONFIGCHANGED
  118.  * lParam  = 0
  119.  *
  120.  *      sent when a config has changed
  121.  */
  122.  
  123. #define DBT_CONFIGCHANGED               0x0018
  124.  
  125. /*
  126.  * Message = WM_DEVICECHANGE
  127.  * wParam  = DBT_CONFIGCHANGECANCELED
  128.  * lParam  = 0
  129.  *
  130.  *      someone cancelled the config change
  131.  */
  132.  
  133. #define DBT_CONFIGCHANGECANCELED        0x0019
  134.  
  135. /*
  136.  * Message = WM_DEVICECHANGE
  137.  * wParam  = DBT_MONITORCHANGE
  138.  * lParam  = new resolution to use (LOWORD=x, HIWORD=y)
  139.  *           if 0, use the default res for current config
  140.  *
  141.  *      this message is sent when the display monitor has changed
  142.  *      and the system should change the display mode to match it.
  143.  */
  144.  
  145. #define DBT_MONITORCHANGE               0x001B
  146.  
  147. /*
  148.  * Message = WM_DEVICECHANGE
  149.  * wParam  = DBT_SHELLLOGGEDON
  150.  * lParam  = 0
  151.  *
  152.  *    The shell has finished login on: VxD can now do Shell_EXEC.
  153.  */
  154.  
  155. #define    DBT_SHELLLOGGEDON        0x0020
  156.  
  157. /*
  158.  * Message = WM_DEVICECHANGE
  159.  * wParam  = DBT_CONFIGMGAPI
  160.  * lParam  = CONFIGMG API Packet
  161.  *
  162.  *    CONFIGMG ring 3 call.
  163.  */
  164. #define    DBT_CONFIGMGAPI32        0x0022
  165.  
  166. /*
  167.  * Message = WM_DEVICECHANGE
  168.  * wParam  = DBT_VOLLOCK*
  169.  * lParam  = pointer to VolLockBroadcast structure described below
  170.  *
  171.  *    Messages issued by IFSMGR for volume locking purposes on WM_DEVICECHANGE.
  172.  *    All these messages pass a pointer to a struct which has no pointers.
  173.  */
  174.  
  175. #define DBT_VOLLOCKQUERYLOCK    0x8041
  176. #define DBT_VOLLOCKLOCKTAKEN    0x8042
  177. #define DBT_VOLLOCKLOCKFAILED    0x8043
  178. #define DBT_VOLLOCKQUERYUNLOCK    0x8044
  179. #define DBT_VOLLOCKLOCKRELEASED    0x8045
  180. #define DBT_VOLLOCKUNLOCKFAILED    0x8046
  181.  
  182. /*
  183.  * Device broadcast header
  184.  */
  185.  
  186. struct _DEV_BROADCAST_HDR {    /* */
  187.     DWORD    dbch_size;
  188.     DWORD    dbch_devicetype;
  189.     DWORD       dbch_reserved;
  190. };
  191.  
  192. typedef struct     _DEV_BROADCAST_HDR    DEV_BROADCAST_HDR;
  193. typedef        DEV_BROADCAST_HDR    DBTFAR *PDEV_BROADCAST_HDR;
  194.  
  195. /*
  196.  * Structure for volume lock broadcast
  197.  */
  198.  
  199. typedef struct VolLockBroadcast VolLockBroadcast;
  200. typedef VolLockBroadcast *pVolLockBroadcast;
  201. struct VolLockBroadcast {
  202.     struct    _DEV_BROADCAST_HDR vlb_dbh;
  203.     DWORD    vlb_owner;        // thread on which lock request is being issued
  204.     BYTE    vlb_perms;        // lock permission flags defined below
  205.     BYTE    vlb_lockType;    // type of lock
  206.     BYTE    vlb_drive;        // drive on which lock is issued
  207.     BYTE    vlb_flags;        // miscellaneous flags
  208. };
  209.  
  210. /*
  211.  * Values for vlb_perms
  212.  */
  213. #define LOCKP_ALLOW_WRITES        0x01    // Bit 0 set - allow writes
  214. #define LOCKP_FAIL_WRITES        0x00    // Bit 0 clear - fail writes
  215. #define LOCKP_FAIL_MEM_MAPPING    0x02    // Bit 1 set - fail memory mappings
  216. #define LOCKP_ALLOW_MEM_MAPPING    0x00    // Bit 1 clear - allow memory mappings
  217. #define LOCKP_USER_MASK            0x03    // Mask for user lock flags
  218. #define LOCKP_LOCK_FOR_FORMAT    0x04    // Level 0 lock for format
  219.  
  220. /*
  221.  * Values for vlb_flags
  222.  */
  223. #define LOCKF_LOGICAL_LOCK        0x00    // Bit 0 clear - logical lock
  224. #define LOCKF_PHYSICAL_LOCK        0x01    // Bit 0 set - physical lock
  225.  
  226.  
  227. /*
  228.  * Message = WM_DEVICECHANGE
  229.  * wParam  = DBT_NODISKSPACE
  230.  * lParam  = drive number of drive that is out of disk space (1-based)
  231.  *
  232.  * Message issued by IFS manager when it detects that a drive is run out of
  233.  * free space.
  234.  */
  235.  
  236. #define DBT_NO_DISK_SPACE        0x0047
  237.  
  238.  
  239. #define DBT_CONFIGMGPRIVATE    0x7FFF
  240.  
  241. /*
  242.  * The following messages are for WM_DEVICECHANGE. The immediate list
  243.  * is for the wParam. ALL THESE MESSAGES PASS A POINTER TO A STRUCT
  244.  * STARTING WITH A DWORD SIZE AND HAVING NO POINTER IN THE STRUCT.
  245.  *
  246.  */
  247. #define DBT_DEVICEARRIVAL        0x8000    // system detected a new device
  248. #define DBT_DEVICEQUERYREMOVE        0x8001    // wants to remove, may fail
  249. #define DBT_DEVICEQUERYREMOVEFAILED    0x8002  // removal aborted         
  250. #define DBT_DEVICEREMOVEPENDING        0x8003  // about to remove, still avail.
  251. #define DBT_DEVICEREMOVECOMPLETE    0x8004  // device is gone
  252. #define DBT_DEVICETYPESPECIFIC        0x8005  // type specific event
  253.  
  254. #define DBT_DEVTYP_OEM            0x00000000  // oem-defined device type
  255. #define DBT_DEVTYP_DEVNODE        0x00000001  // devnode number
  256. #define DBT_DEVTYP_VOLUME        0x00000002  // logical volume
  257. #define DBT_DEVTYP_PORT            0x00000003  // serial, parallel
  258. #define DBT_DEVTYP_NET            0x00000004  // network resource
  259.  
  260. struct _DEV_BROADCAST_HEADER { /* */
  261.     DWORD    dbcd_size;
  262.     DWORD    dbcd_devicetype;
  263.     DWORD       dbcd_reserved;
  264. };
  265.  
  266. struct _DEV_BROADCAST_OEM {    /* */
  267.     DWORD    dbco_size;
  268.     DWORD    dbco_devicetype;
  269.     DWORD       dbco_reserved;
  270.     DWORD    dbco_identifier;
  271.     DWORD    dbco_suppfunc;
  272. };
  273.  
  274. typedef struct     _DEV_BROADCAST_OEM    DEV_BROADCAST_OEM;
  275. typedef        DEV_BROADCAST_OEM    DBTFAR *PDEV_BROADCAST_OEM;
  276.  
  277. struct _DEV_BROADCAST_DEVNODE { /* */
  278.     DWORD    dbcd_size;
  279.     DWORD    dbcd_devicetype;
  280.     DWORD       dbcd_reserved;
  281.     DWORD    dbcd_devnode;
  282. };
  283.  
  284. typedef struct     _DEV_BROADCAST_DEVNODE    DEV_BROADCAST_DEVNODE;
  285. typedef        DEV_BROADCAST_DEVNODE    DBTFAR *PDEV_BROADCAST_DEVNODE;
  286.  
  287. struct _DEV_BROADCAST_VOLUME { /* */
  288.     DWORD    dbcv_size;
  289.     DWORD    dbcv_devicetype;
  290.     DWORD       dbcv_reserved;
  291.     DWORD    dbcv_unitmask;
  292.     WORD    dbcv_flags;
  293. };
  294.  
  295. typedef struct     _DEV_BROADCAST_VOLUME    DEV_BROADCAST_VOLUME;
  296. typedef        DEV_BROADCAST_VOLUME    DBTFAR *PDEV_BROADCAST_VOLUME;
  297.  
  298. #define DBTF_MEDIA    0x0001        // media comings and goings
  299. #define DBTF_NET    0x0002        // network volume
  300.  
  301. struct _DEV_BROADCAST_PORT { /* */
  302.     DWORD    dbcp_size;
  303.     DWORD    dbcp_devicetype;
  304.     DWORD       dbcp_reserved;
  305.     char    dbcp_name[1];
  306. };
  307.  
  308. typedef struct     _DEV_BROADCAST_PORT    DEV_BROADCAST_PORT;
  309. typedef        DEV_BROADCAST_PORT    DBTFAR *PDEV_BROADCAST_PORT;
  310.  
  311. struct _DEV_BROADCAST_NET { /* */
  312.     DWORD    dbcn_size;
  313.     DWORD    dbcn_devicetype;
  314.     DWORD       dbcn_reserved;
  315.     DWORD    dbcn_resource;
  316.     DWORD    dbcn_flags;
  317. };
  318.  
  319. typedef struct     _DEV_BROADCAST_NET    DEV_BROADCAST_NET;
  320. typedef        DEV_BROADCAST_NET    DBTFAR *PDEV_BROADCAST_NET;
  321.  
  322. #define DBTF_RESOURCE    0x00000001    // network resource
  323. #define DBTF_XPORT        0x00000002    // new transport coming or going
  324. #define DBTF_SLOWNET    0x00000004  // new incoming transport is slow
  325.                     // (dbcn_resource undefined for now)
  326.  
  327. #define    DBT_VPOWERDAPI    0x8100        // VPOWERD API for Win95
  328.  
  329. /*
  330.  *  User-defined message types all use wParam = 0xFFFF with the
  331.  *  lParam a pointer to the structure below.
  332.  *
  333.  *  dbud_dbh - DEV_BROADCAST_HEADER must be filled in as usual.
  334.  *
  335.  *  dbud_szName contains a case-sensitive ASCIIZ name which names the
  336.  *  message.  The message name consists of the vendor name, a backslash,
  337.  *  then arbitrary user-defined ASCIIZ text.  For example:
  338.  *
  339.  *    "WidgetWare\QueryScannerShutdown"
  340.  *    "WidgetWare\Video Q39S\AdapterReady"
  341.  *
  342.  *  After the ASCIIZ name, arbitrary information may be provided.
  343.  *  Make sure that dbud_dbh.dbch_size is big enough to encompass
  344.  *  all the data.  And remember that nothing in the structure may
  345.  *  contain pointers.
  346.  */
  347.  
  348. #define DBT_USERDEFINED    0xFFFF
  349.  
  350. struct _DEV_BROADCAST_USERDEFINED { /* */
  351.     struct _DEV_BROADCAST_HDR dbud_dbh;
  352.     char    dbud_szName[1];        /* ASCIIZ name */
  353. /*  BYTE    dbud_rgbUserDefined[];*/ /* User-defined contents */
  354. };
  355.  
  356. #endif    // _DBT_H
  357.